package it.nola.soccer.adapter;

import it.nola.soccer.AbstractSoccerActivity;
import android.database.Cursor;
import android.widget.SimpleCursorAdapter;

/**
 * Generica classe astratta da cui discendo gli altri SimpleCursorAdapter
 * 
 * @author pcasillo
 */
abstract public class AbstractCursorAdapter extends SimpleCursorAdapter {

    protected AbstractSoccerActivity activity;
    protected int[] myTo;
    protected String[] myFrom;

    public AbstractCursorAdapter(AbstractSoccerActivity context, int layout, Cursor c, String[] from, int[] to) {
	super(context, layout, c, from, to);
	activity=context;
	myTo=to;
	myFrom=from;
    }

    public int[] findColumns(String[] from) {
	int count=from.length;
	int[] ret=new int[count];
	for (int i=0; i<count; i++) {
	    ret[i]=super.getCursor().getColumnIndexOrThrow(from[i]);
	}
	return ret;
    }

}
